package com.mentaleye.dal.dao.mybatis;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.mentaleye.dal.dao.TransactionDao;
import com.mentaleye.dal.model.Transaction;
import com.mentaleye.dal.model.TransactionExample;
import com.mentaleye.dal.service.TransactionMapper;

@Repository
public class TransactionDaoImpl extends BaseDao implements TransactionDao{

	@Autowired TransactionMapper transactionMapper;
	
	@Override
	public boolean insertTransaction(Transaction transaction){
		return getResultByInt(transactionMapper.insertSelective(transaction));
	}
	
	@Override
	public boolean updateTransaction(Transaction transaction){
		return getResultByInt(transactionMapper.updateByPrimaryKeySelective(transaction));
	}
	
	@Override
	public boolean deleteTransaction(String transactionId){
		return getResultByInt(transactionMapper.deleteByPrimaryKey(transactionId));
	}
	
	@Override
	public Transaction selectTransactionByKey(String transactionId){
		return transactionMapper.selectByPrimaryKey(transactionId);
	}
	
	@Override
	public List<Transaction> selectTransactionByExample(TransactionExample example){
		return transactionMapper.selectByExample(example);
	}
	
	@Override
	public List<Transaction> selectTransactionByMap(Map<String, Object> map){
		return transactionMapper.selectByMap(map);
	}
}
